package com.it.schoolbookshop_back.enums;

/**
 * 通知类型枚举
 */
public enum NotificationType {
    /**
     * 消息通知
     */
    MESSAGE("message"),
    
    /**
     * 收藏通知
     */
    FAVORITE("favorite"),
    
    /**
     * 交易通知
     */
    TRANSACTION("transaction");
    
    private final String type;
    
    NotificationType(String type) {
        this.type = type;
    }
    
    public String getType() {
        return type;
    }
    
    /**
     * 根据类型字符串获取枚举值
     * @param type 类型字符串
     * @return 枚举值，如果不匹配则返回null
     */
    public static NotificationType fromString(String type) {
        for (NotificationType notificationType : NotificationType.values()) {
            if (notificationType.type.equalsIgnoreCase(type)) {
                return notificationType;
            }
        }
        return null;
    }
} 